package com.sicpa.web.controller.tool;

import com.sicpa.common.core.domain.AjaxResult;
import com.sicpa.common.core.domain.entity.AssuranceBusinessDataReport;
import com.sicpa.system.service.IAssuranceBusinessDataReportService;
import com.sicpa.system.service.ICaAuthServcie;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * TestController
 * @author lwf
 */
@RestController
@RequestMapping("/test")
public class TestController {

    private ICaAuthServcie iCaAuthServcie;

    @Autowired
    public TestController(ICaAuthServcie iCaAuthServcie) {
        this.iCaAuthServcie = iCaAuthServcie;
    }

    @Autowired
    private IAssuranceBusinessDataReportService iAssuranceBusinessDataReportService;

    @RequestMapping("/index")
    public String test(@RequestParam("ca") String ca){
        iCaAuthServcie.caVerifySignature(ca);
        return "success";
    }

    @GetMapping("/testOnly")
    public AjaxResult testOnly() throws Exception {
        List<AssuranceBusinessDataReport> assuranceBusinessDataReports = new ArrayList<>();
        AssuranceBusinessDataReport dataReport1 = new AssuranceBusinessDataReport();
        dataReport1.setFirmName("北京兴华会计师事务所（特殊普通合伙）上海分所");
        dataReport1.setReportCode("test0001");
        assuranceBusinessDataReports.add(dataReport1);
        AssuranceBusinessDataReport dataReport2 = new AssuranceBusinessDataReport();
        dataReport2.setFirmName("利安达会计师事务所（特殊普通合伙）上海分所");
        dataReport1.setReportCode("test0002");
        assuranceBusinessDataReports.add(dataReport2);
        AssuranceBusinessDataReport dataReport3 = new AssuranceBusinessDataReport();
        dataReport3.setFirmName("岳华会计师事务所有限责任公司上海分所");
        dataReport1.setReportCode("test0003");
        assuranceBusinessDataReports.add(dataReport3);
        //iAssuranceBusinessDataReportService.siaImportReport(assuranceBusinessDataReports,"");
        return AjaxResult.success();
    }
}
